<template>
  <div class="container">
    <Item v-for=" item of top250" :key="item.id" :data="item" @click.native="handleClick(item._id)"></Item>
  </div>
</template>

<script>
export default {
  data() {
    return {
      top250:[]
    }
  },
  mounted(){
    this.$http(`http://124.70.134.133:7001/api/movie/top250`).then(res=>{
      // console.log(res.data.res);
      res.data.res.forEach(item=>{
        var {pic,title} = item;
        item.name = title;
        item.coverImgUrl = pic;
      })
      this.top250 = res.data.res
    })
  },
  methods:{
    handleClick(val){
      var id = val
      this.$router.push(`/Top250Detail/${id}`)
    }
  }
}
</script>

<style>

</style>